<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>


<div class="layui-fluid" id="app">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">

            <div class="layui-card">
                <!--<div class="layui-card-header">按钮主题</div>-->
                <!--<div class="layui-card-header">网站设置</div>-->
                <div class="layui-card-body">

                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title">
                            <li class="layui-this">网站设置</li>
                            <!--<li id="add">新增</li>-->

                        </ul>
                        <div class="layui-tab-content" style="padding-left: 0px;padding-right: 0px">

                            <div class="layui-tab-item layui-show">

                                <div class="layui-form" wid100="" lay-filter="">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="sitename" placeholder="请输入.."
                                                   value="{$item.sitename}" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">域名</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="domain" placeholder="请输入.." lay-verify="url"
                                                   value="{$item.domain}"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <!--<div class="layui-form-item">-->
                                    <!--<label class="layui-form-label">缓存时间</label>-->
                                    <!--<div class="layui-input-inline" style="width: 80px;">-->
                                    <!--<input type="text" name="cache" lay-verify="number" value="0" class="layui-input">-->
                                    <!--</div>-->
                                    <!--<div class="layui-input-inline layui-input-company">分钟</div>-->
                                    <!--<div class="layui-form-mid layui-word-aux">本地开发一般推荐设置为 0，线上环境建议设置为 10。</div>-->
                                    <!--</div>-->
                                    <!--<div class="layui-form-item">-->
                                    <!--<label class="layui-form-label">最大文件上传</label>-->
                                    <!--<div class="layui-input-inline" style="width: 80px;">-->
                                    <!--<input type="text" name="cache" lay-verify="number" value="2048" class="layui-input">-->
                                    <!--</div>-->
                                    <!--<div class="layui-input-inline layui-input-company">KB</div>-->
                                    <!--<div class="layui-form-mid layui-word-aux">提示：1 M = 1024 KB</div>-->
                                    <!--</div>-->
                                    <!--<div class="layui-form-item">-->
                                    <!--<label class="layui-form-label">上传文件类型</label>-->
                                    <!--<div class="layui-input-block">-->
                                    <!--<input type="text" name="cache" value="png|gif|jpg|jpeg|zip|rar" class="layui-input">-->
                                    <!--</div>-->
                                    <!--</div>-->

                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">首页标题</label>
                                        <div class="layui-input-block">
                                            <textarea name="title" placeholder="请输入.." class="layui-textarea">{$item.title}</textarea>
                                        </div>
                                    </div>
                                    <!--<div class="layui-form-item layui-form-text">-->
                                    <!--<label class="layui-form-label">META关键词</label>-->
                                    <!--<div class="layui-input-block">-->
                                    <!--<textarea name="keywords" class="layui-textarea"-->
                                    <!--placeholder="多个关键词用英文状态 , 号分割"></textarea>-->
                                    <!--</div>-->
                                    <!--</div>-->
                                    <!--<div class="layui-form-item layui-form-text">-->
                                    <!--<label class="layui-form-label">META描述</label>-->
                                    <!--<div class="layui-input-block">-->
                                    <!--<textarea name="descript" class="layui-textarea"></textarea>-->
                                    <!--</div>-->
                                    <!--</div>-->
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">客服电话</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="kefu_tel" placeholder="请输入.."
                                                   value="{$item.kefu_tel}"
                                                   class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">版权信息</label>
                                        <div class="layui-input-block">
                                            <textarea name="copyright"
                                              placeholder="请输入.."
                                              class="layui-textarea">{$item.copyright}</textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item form-footer2">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit="" lay-filter="set_website">确认保存
                                            </button>
                                        </div>
                                    </div>
                                </div>


                            </div>


                        </div>
                    </div>


                </div>
            </div>

        </div>


    </div>
</div>

<script>


    layui.use(['form', 'upload', 'element'], function () {
        var $ = layui.$
            , layer = layui.layer
            , form = layui.form
            , element = layui.element
            , upload = layui.upload;

        //网站设置
        form.on('submit(set_website)', function (obj) {
//            layer.msg(JSON.stringify(obj.field));

            $.post("{:url('index')}", obj.field, function (res) {
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1})
                    return false;
                } else {
                    layer.msg(res.msg, {icon: 2}, function () {
                        location.reload();
                    })
                    return false;
                }

            });

            return false;
        });


        //上传头像
        var avatarSrc = $('#LAY_avatarSrc');
        upload.render({
            url: '/api/upload/'
            , elem: '#LAY_avatarUpload'
            , done: function (res) {
                if (res.status == 0) {
                    avatarSrc.val(res.url);
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });

        //查看头像
        function avatar() {
            var src = avatarSrc.val();
            layer.photos({
                photos: {
                    "title": "查看头像" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        }


    });

</script>
</body>
</html>




